package exttable.testselector;

import utils.Localisation;

import javax.swing.*;
import javax.swing.table.TableCellRenderer;
import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: Admin
 * Date: Jan 15, 2010
 * Time: 12:38:42 AM
 * To change this template use File | Settings | File Templates.
 */
public class TimeTableRenderer implements TableCellRenderer {

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        JComponent jb = new JButton(value.toString());
        if (value.equals(Localisation.getMessage("timetable.result"))) {
            jb.setBackground(Color.GREEN);
            jb.setToolTipText(Localisation.getMessage("tooltip.viewdata"));
        }
        if (value.equals(Localisation.getMessage("timetable.fill"))) {
            jb.setBackground(Color.RED);
            jb.setToolTipText(Localisation.getMessage("tooltip.enterdata"));
        }
        if (value.equals(Localisation.getMessage("timetable.waiting"))) {
            jb.setBackground(Color.YELLOW);
            jb.setToolTipText(Localisation.getMessage("tooltip.waiting"));
        }
        if (value.equals(Localisation.getMessage("timetable.noreq"))) {
            jb.setBackground(Color.GRAY);
            jb.setToolTipText(Localisation.getMessage("tooltip.notest"));
            jb.setEnabled(false);
        }
        return jb;
    }

    
}
